/* --- UPDATED: Floating Header Buttons Styles --- */


.header-buttons {
    display: flex;
    align-items: center;
    gap: 10px; /* Reduced gap slightly for a tighter look */
}

.header-button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    
    /* Add a semi-transparent background to the buttons themselves for visibility */
    background-color: rgba(0, 0, 0, 0.2); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

.dark-mode .header-button {
    background-color: rgba(40, 40, 40, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-button:hover {
    color: var(--primary);
    border-color: var(--primary);
    background-color: rgba(16, 163, 127, 0.2);
}
/* --- NEW: Sidebar Brand & Actions Styles --- */

.sidebar-brand {
    padding: 20px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.sidebar-brand span {
    font-size: 12px;
    color: var(--text-2);
}

.sidebar-actions {
    display: flex;
    justify-content: space-around;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); display: none; align-items: center; justify-content: center; z-index: 1000; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
.modal-overlay.active { opacity: 1; pointer-events: all; display: flex; }
.modal { background-color: var(--darker-bg, #111); border-radius: 12px; width: 90%; max-width: 500px; transform: scale(0.95); transition: transform 0.3s ease; }
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { padding: 20px; border-bottom: 1px solid var(--border-color, #333); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 20px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 24px; color: var(--text-secondary, #999); cursor: pointer; }
.modal-body { padding: 20px; }
.profile-container { display: flex; flex-direction: column; align-items: center; text-align: center; }
.profile-avatar { width: 100px; height: 100px; border-radius: 50%; background-color: var(--card-bg, #141414); display: flex; align-items: center; justify-content: center; margin-bottom: 20px; position: relative; overflow: hidden; border: 3px solid var(--accent-color, #d9785f); font-size: 48px; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.upload-btn { position: absolute; bottom: 0; right: 0; width: 30px; height: 30px; background-color: var(--accent-color, #d9785f); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; cursor: pointer; }
.profile-name { font-size: 22px; font-weight: 600; margin-bottom: 5px; }
.profile-birthday { font-size: 14px; color: var(--text-secondary, #999); margin-bottom: 20px; }
.profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; margin-bottom: 20px; }
.stat-card { background-color: var(--card-bg, #141414); border-radius: 8px; padding: 15px; }
.stat-value { font-size: 24px; font-weight: 700; margin-bottom: 5px; color: var(--accent-color, #d9785f); }
.stat-label { font-size: 10px; color: var(--text-secondary, #999); text-transform: uppercase; }
.status-indicator { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 8px 12px; background-color: rgba(244, 67, 54, 0.1); border-radius: 20px; }
.status-dot { width: 8px; height: 8px; background-color: var(--error-color, #F44336); border-radius: 50%; }
.status-text { font-size: 13px; color: var(--error-color, #F44336); }
.status-indicator.verified { background-color: rgba(76, 175, 80, 0.1); }
.status-indicator.verified .status-dot { background-color: var(--success-color, #4CAF50); }
.status-indicator.verified .status-text { color: var(--success-color, #4CAF50); }
/* --- NEW: Styles for Buttons Inside Modals --- */
.modal-button {
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  border: none;
  font-size: 14px;
}

.modal-button.primary {
  background-color: var(--primary-color, var(--primary)); /* Uses your theme color */
  color: white;
}

.modal-button.primary:hover {
  background-color: var(--primary-hover, var(--primary-dark));
}

.modal-button.secondary {
  background-color: transparent;
  border: 1px solid var(--border-color, var(--border)); /* Uses your theme border color */
  color: var(--text-color, var(--text)); /* Uses your theme text color */
}

.modal-button.secondary:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-color, var(--primary));
}

/* --- NEW: Character Counter & Warning Styles --- */

.char-counter-container {
    text-align: right;
    font-size: 12px;
    color: var(--text-2);
    height: 15px; /* Reserve space to prevent layout shift */
    padding-right: 5px;
    margin-top: 2px;
}

#charCounter.limit-exceeded {
    color: var(--warning);
    font-weight: 600;
}

/* Style for the warning message (yellow color) */
.error-message.warning {
    color: var(--warning);
    background-color: rgba(245, 166, 35, 0.1);
}
/* --- NEW: Registration Prompt Card Styles --- */
.register-prompt-card {
    display: none; /* Initially hidden */
    background-color: rgba(255, 187, 0, 0.144); /* Transparent green */
    border: 1px solid rgb(255, 145, 0);
    color: rgb(0, 0, 0);
    padding: 12px 20px;
    border-radius: 8px;
    margin-top: 24px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: default;
}

.dark-mode .register-prompt-card {
    color: #ffffff; /* Brighter green for dark mode */
}

/* Mobile උපාංග වලදී Code Block පිට පැනීම නැවැත්වීම සඳහා */

.message-text pre[class*="language-"] {
    /* දකුණට දිගු වන කේත සඳහා horizontal scrollbar එකක් එක් කරයි */
    overflow-x: auto !important;

    /* Code formatting එක ඒ ආකාරයෙන්ම තබා ගැනීමට උපකාරී වේ */
    white-space: pre !important;

    /* වචන සහ කේත අනවශ්‍ය ලෙස කැඩීම වළක්වයි */
    word-wrap: normal !important;
}
/*
  සාමාන්‍ය පණිවිඩවල දිගු වචන (උදා: URL) නිසා UI එක පිට පැනීම නැවැත්වීමට
*/
.message-text {
    overflow-wrap: break-word;
    word-wrap: break-word; /* පැරණි බ්‍රවුසර් සඳහා අමතර සහාය */
    word-break: break-word; /* තවත් fallback එකක් */
}

/* --- Desktop Sidebar Toggle සඳහා වන ස්ථිර විසඳුම --- */
/* කරුණාකර, මෙම කොටස ඔබගේ <style> ටැගයේ පහළම කොටසට එක් කරන්න */

/* 1. Toggle බොත්තම සෑම විටම දර්ශනය කර තැබීමට !important භාවිතා කිරීම */
.sidebar-toggle {
    display: flex !important;
}

/* 2. Desktop වලදීත්, sidebar එක පෙරනිමියෙන් සඟවා තැබීම */
/* (Mobile සහ Desktop දෙකේදීම එකම හැසිරීමක් සඳහා) */
.sidebar {
    transform: translateX(-100%);
    position: fixed; /* 'absolute' වෙනුවට 'fixed' යෙදීම වඩාත් සුදුසුයි */
}

/* 3. .open class එක ඇති විට sidebar එක පෙන්වීම */
.sidebar.open {
    transform: translateX(0);
}

/* 4. ප්‍රධාන අන්තර්ගතය, sidebar එකේ තත්ත්වය අනුව හැසිරවීම */
.main-content {
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

/* Desktop වලදී පමණක්, sidebar එක open වූ විට, main-content එක දකුණට තල්ලු කිරීම */
/* Mobile වලදී sidebar එක content එකට ඉහළින් (overlay) දිස්වේ */
@media (min-width: 769px) { /* 768px ට වඩා වැඩි තිර සඳහා */
    .sidebar.open + .main-content {
        margin-left: var(--sidebar-width);
    }
}

/* =================================== */
/* දැනුම්දීම් Pop-up සඳහා වන Styles   */
/* =================================== */
.info-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10010; /* Ensure it's on top of other content */
    opacity: 0;
    pointer-events: none; /* Disable interaction when hidden */
    transition: opacity 0.3s ease-in-out;
}

.info-popup-overlay.open {
    opacity: 1;
    pointer-events: auto; /* Enable interaction when visible */
}

.info-popup-card {
    background-color: var(--bg);
    color: var(--text);
    padding: 24px 28px;
    border-radius: 12px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 480px;
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.3s ease-in-out;
}

.info-popup-overlay.open .info-popup-card {
    transform: scale(1);
}

.info-popup-card h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--primary);
}

.info-popup-card p {
    margin-bottom: 0;
    line-height: 1.7;
    font-size: 16px;
    color: var(--text-2);
}